/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ihc.terminalbanco.gui.panels;

import ihc.terminalbanco.gui.events.Events;
import ihc.terminalbanco.gui.events.KeyActions;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextPane;

/**
 *
 * @author Rafael
 */
public class AvisoPainel extends JPanel implements Runnable, RotulosInterface{

    Events events;
    KeyActions keyActions;
    public static Font fonte = ConstructMenusPanels.fonte;
    private int tempo;
    private JPanel proximoPanel;

    public AvisoPainel(Events events, KeyActions keyActions, String avisoTitulo,
            String avisoTexto){

        this.setLayout(new BorderLayout());

        JPanel painelAviso = new JPanel();
        painelAviso.setLayout(new GridLayout(2, 1 ,50,40));
/*
        JLabel avisoTituloLabel = new JLabel(avisoTitulo);
        avisoTituloLabel.setFont(fonte);
        painelAviso.add(avisoTituloLabel);
  */
        JTextPane avisoTituloField = new JTextPane();
        avisoTituloField.setText(avisoTitulo);
        avisoTituloField.setEditable(false);
        avisoTituloField.setOpaque(false);
        avisoTituloField.setFont(fonte);
        painelAviso.add(avisoTituloField);



        JTextPane avisoTextoField = new JTextPane();
        avisoTextoField.setText(avisoTexto);
        avisoTextoField.setEditable(false);
        avisoTextoField.setOpaque(false);
        avisoTextoField.setFont(fonte);
        painelAviso.add(avisoTextoField);

        this.events = events;
/*
        JLabel bloqueado24Saldo = new JLabel("(+)BLQ 24 HS");
        bloqueado24Saldo.setFont(font);
        painelSaldo.add(bloqueado24Saldo);

        JLabel bloqueado24Field = new JLabel("0,00");
        bloqueado24Field.setFont(font);
        //bloqueado24Field.setEditable(false);
        painelSaldo.add(bloqueado24Field);

        JLabel bloqueadoPorMais24Saldo = new JLabel("(+)BLQ + 24 HS");
        bloqueadoPorMais24Saldo.setFont(font);
        painelSaldo.add(bloqueadoPorMais24Saldo);

        JLabel bloqueadoPorMais24Field = new JLabel("0,00");
        bloqueadoPorMais24Field.setFont(font);
        painelSaldo.add(bloqueadoPorMais24Field);

        JLabel limiteSaldo = new JLabel("Limite");
        limiteSaldo.setFont(font);
        painelSaldo.add(limiteSaldo);

        JLabel limiteField = new JLabel("0,00");
        limiteField.setFont(font);
        painelSaldo.add(limiteField);
*/
        JPanel painelNorte = new JPanel();
        painelNorte.setLayout(new BorderLayout());

        painelNorte.add(painelAviso, BorderLayout.CENTER);
        JPanel painelLeste = new JPanel(), painelOeste = new JPanel(),
               painelNorteInterno = new JPanel();
        painelLeste.setPreferredSize(new Dimension(150,100));
        painelOeste.setPreferredSize(new Dimension(150,100));
        painelNorteInterno.setPreferredSize(new Dimension(100,100));

        painelNorte.add(painelLeste, BorderLayout.EAST);
        painelNorte.add(painelOeste, BorderLayout.WEST);
        painelNorte.add(painelNorteInterno, BorderLayout.NORTH);


        JPanel painelSul = new JPanel();
        painelSul.setLayout(new GridLayout(1, 1,100,0));

        JButton voltarButton = new JButton("Voltar");
        voltarButton.setFont(fonte);
        voltarButton.addActionListener(events);
        voltarButton.setVisible(false);
        painelSul.add(voltarButton);

        JButton confirmarButton = new JButton(confirmarString);
        confirmarButton.setFont(fonte);
        confirmarButton.addActionListener(events);
        painelSul.add(confirmarButton);

        painelSul.setPreferredSize(new Dimension(480, 100));
        this.add(painelNorte, BorderLayout.NORTH );
        this.add(painelSul, BorderLayout.SOUTH);
        //System.out.println("Executando!");
        /*Em Construção*/
    }

    public void inicializaTempoEProximoPainel(int tempo, JPanel proximoPanel){
        this.tempo = tempo;
        this.proximoPanel = proximoPanel;
    }

    public void esperaETroca(){/*
        long tempoInicial = System.currentTimeMillis();
        long tempoAtual = 0;*/
        /*this.sl
        while ((tempoAtual - tempoInicial) < 3000) {
               	tempoAtual = System.currentTimeMillis();
        }*/
        this.events.atualizaFrameInterface(proximoPanel);
    }

    public void run() {
        esperaETroca();
    }



}

